<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.model' );
class EcommerceModelCategory extends JModel
{
	var $_catid = null;
	
	function __construct()
	{
		parent::__construct();
		$catid = intval(JRequest::getVar('catid', 0));
		$this->_catid = $catid;
	}
	
	function getChildren()
	{
		$query = "SELECT id, alias, name FROM #__pr_category WHERE parent_id = ".$this->_catid;
		$this->_db->setQuery($query);
		$children = $this->_db->loadObjectList();

		return $children;
	}
	
	function getInfo(){
		$query = "SELECT * FROM #__pr_category WHERE id = ".$this->_catid;
		$this->_db->setQuery($query);
		$info = $this->_db->loadObject();
		
		return $info;
	}
	
}
?>